﻿import QtQuick 2.15
import QtQuick.Controls 2.15

Item {
    width: screenWidth
    height: screenHeight

    Item{
        id:backGround
        anchors.fill: parent
    }

    Rectangle{
        anchors.top: backGround.top
        anchors.topMargin: 210
        anchors.left: backGround.left
        anchors.leftMargin: 10
        color: "#0b49b0"
        border.width: 1
        border.color: "#008edd"
        width: 1060
        height: 1550

        Column{
            anchors.top: parent.top
            anchors.topMargin: 100
            anchors.left: parent.left
            anchors.leftMargin: 10
            spacing: 40

            Repeater{
                model:11

                Rectangle{
                    width: 200
                    height: 80
                    color: "transparent"

                    Text{
                        anchors.centerIn: parent
                        font.pixelSize: 40
                        font.bold: true
                        color: "white"
                        text:index === 0 ? "刀 盘" :
                             index === 1 ? "胶 辊" :
                             index === 2 ? "压力1":
                             index === 3 ? "压力2":
                             index === 4 ? "压力3":
                             index === 5 ? "前刀1":
                             index === 6 ? "前刀2":
                             index === 7 ? "前刀3":
                             index === 8 ? "后刀1":
                             index === 9 ? "后刀2":
                                           "后刀3"
                    }
                }
            }
        }


        Rectangle{
            width: 200
            height: 80
            anchors.top: parent.top
            anchors.topMargin: 10
            anchors.left: parent.left
            anchors.leftMargin: 220
            color: "transparent"

            Text{
                anchors.centerIn: parent
                font.pixelSize: 40
                font.bold: true
                color: "white"
                text:"当前值"
            }
        }

        Column{
            anchors.top: parent.top
            anchors.topMargin: 100
            anchors.left: parent.left
            anchors.leftMargin: 220
            spacing: 40

            Repeater{
                model:11

                Rectangle{
                    width: 200
                    height: 80
                    color: "#00adfb"
                    radius: 10
                    border.width: 1
                    border.color: "#008edd"

                    Text{           // 当前位置
                        anchors.centerIn: parent
                        font.pixelSize: 40
                        font.bold: true
                        color: "white"
                        text:index === 0 ? Cpp_Connect.knifeCurrLocation :
                             index === 1 ? Cpp_Connect.rollerCurrLocation :
                             index === 2 ? Cpp_Connect.stress01CurrLocation :
                             index === 3 ? Cpp_Connect.stress02CurrLocation :
                             index === 4 ? Cpp_Connect.stress03CurrLocation :
                             index === 5 ? Cpp_Connect.f_knife01CurrLocation :
                             index === 6 ? Cpp_Connect.f_knife02CurrLocation :
                             index === 7 ? Cpp_Connect.f_knife03CurrLocation :
                             index === 8 ? Cpp_Connect.b_knife01CurrLocation :
                             index === 9 ? Cpp_Connect.b_knife02CurrLocation :
                                           Cpp_Connect.b_knife03CurrLocation
                    }
                }
            }
        }

        Rectangle{
            width: 200
            height: 80
            anchors.top: parent.top
            anchors.topMargin: 10
            anchors.left: parent.left
            anchors.leftMargin: 530
            color: "transparent"

            Text{
                anchors.centerIn: parent
                font.pixelSize: 40
                font.bold: true
                color: "white"
                text:"设定值"
            }
        }

        Rectangle{
            width: 200
            height: 80
            color: "#00adfb"
            radius: 10
            border.width: 1
            border.color: "#008edd"
            anchors.top: parent.top
            anchors.topMargin: 100
            anchors.left: parent.left
            anchors.leftMargin: 530

            Text{           // 刀盘待命点
                id:knifeAimLocation
                anchors.centerIn: parent
                font.pixelSize: 40
                font.bold: true
                color: "white"
                text: Cpp_Connect.knifeStandby
            }

            // TextInput{
            //     id:knifeAimLocation_Input
            //     anchors.centerIn: parent
            //     font.pixelSize: 40
            //     font.bold: true
            //     visible: false
            //     color: "white"
            //     selectByMouse: true
            //     maximumLength: 8
            //     //@disabel-check M16
            //     // verticalAlignment: Text.verticalAlignment
            //     horizontalAlignment: Text.horizontalAlignment
            //     text:knifeAimLocation.text
            //     //@disabel-check M16
            //     // onEditingFinished: {
            //     //     knifeAimLocation.text = knifeAimLocation_Input.text
            //     //     knifeAimLocation_Input.visible = false
            //     //     knifeAimLocation.visible = true
            //     // }

            //     onAccepted: {
            //         // knifeAimLocation.text = knifeAimLocation_Input.text
            //         knifeAimLocation_Input.visible = false
            //         knifeAimLocation.visible = true
            //         Cpp_Connect.write_modbus_tcp_TwoHoldingResgisters("3200",knifeAimLocation_Input.text)
            //     }
            // }

            // MouseArea{
            //     anchors.fill: parent
            //     acceptedButtons: Qt.LeftButton
            //     //@disabel-check M16
            //     propagateComposedEvents: true

            //     onClicked: {
            //         mouse.accepted = false
            //         knifeAimLocation.visible = false
            //         knifeAimLocation_Input.visible = true
            //         knifeAimLocation_Input.forceActiveFocus()
            //     }
            // }
        }

        Rectangle{
            width: 200
            height: 80
            color: "#00adfb"
            radius: 10
            border.width: 1
            border.color: "#008edd"
            anchors.top: parent.top
            anchors.topMargin: 220
            anchors.left: parent.left
            anchors.leftMargin: 530

            Text{           // 胶辊待命点
                id:rollerAimLocation
                anchors.centerIn: parent
                font.pixelSize: 40
                font.bold: true
                color: "white"
                text: Cpp_Connect.rollerStandby
            }

            // TextInput{
            //     id:rollerAimLocation_Input
            //     anchors.centerIn: parent
            //     font.pixelSize: 40
            //     font.bold: true
            //     visible: false
            //     color: "white"
            //     selectByMouse: true
            //     maximumLength: 8
            //     //@disabel-check M16
            //     // verticalAlignment: Text.verticalAlignment
            //     horizontalAlignment: Text.horizontalAlignment
            //     text:rollerAimLocation.text
            //     //@disabel-check M16
            //     onEditingFinished: {
            //         // rollerAimLocation.text = rollerAimLocation_Input.text
            //         rollerAimLocation_Input.visible = false
            //         rollerAimLocation.visible = true
            //         Cpp_Connect.write_modbus_tcp_TwoHoldingResgisters("3200",knifeAimLocation_Input.text)
            //     }
            // }

            // MouseArea{
            //     anchors.fill: parent
            //     acceptedButtons: Qt.LeftButton
            //     //@disabel-check M16
            //     propagateComposedEvents: true

            //     onClicked: {
            //         mouse.accepted = false
            //         rollerAimLocation.visible = false
            //         rollerAimLocation_Input.visible = true
            //         rollerAimLocation_Input.forceActiveFocus()
            //     }
            // }
        }

        Rectangle{
            width: 200
            height: 80
            color: "#00adfb"
            radius: 10
            border.width: 1
            border.color: "#008edd"
            anchors.top: parent.top
            anchors.topMargin: 340
            anchors.left: parent.left
            anchors.leftMargin: 530

            Text{           // 压力1待命点
                id:stress01AimLocation
                anchors.centerIn: parent
                font.pixelSize: 40
                font.bold: true
                color: "white"
                text: Cpp_Connect.stress01Standby
            }

            // TextInput{
            //     id:stress01AimLocation_Input
            //     anchors.centerIn: parent
            //     font.pixelSize: 40
            //     font.bold: true
            //     visible: false
            //     color: "white"
            //     selectByMouse: true
            //     maximumLength: 8
            //     //@disabel-check M16
            //     // verticalAlignment: Text.verticalAlignment
            //     horizontalAlignment: Text.horizontalAlignment
            //     text:stress01AimLocation.text
            //     //@disabel-check M16
            //     onEditingFinished: {
            //         stress01AimLocation.text = stress01AimLocation_Input.text
            //         stress01AimLocation_Input.visible = false
            //         stress01AimLocation.visible = true
            //     }
            // }

            // MouseArea{
            //     anchors.fill: parent
            //     acceptedButtons: Qt.LeftButton
            //     //@disabel-check M16
            //     propagateComposedEvents: true

            //     onClicked: {
            //         mouse.accepted = false
            //         stress01AimLocation.visible = false
            //         stress01AimLocation_Input.visible = true
            //         stress01AimLocation_Input.forceActiveFocus()
            //     }
            // }
        }

        Rectangle{
            width: 200
            height: 80
            color: "#00adfb"
            radius: 10
            border.width: 1
            border.color: "#008edd"
            anchors.top: parent.top
            anchors.topMargin: 460
            anchors.left: parent.left
            anchors.leftMargin: 530

            Text{           // 压力2待命点
                id:stress02AimLocation
                anchors.centerIn: parent
                font.pixelSize: 40
                font.bold: true
                color: "white"
                text: Cpp_Connect.stress02Standby
            }

            // TextInput{
            //     id:stress02AimLocation_Input
            //     anchors.centerIn: parent
            //     font.pixelSize: 40
            //     font.bold: true
            //     visible: false
            //     color: "white"
            //     selectByMouse: true
            //     maximumLength: 8
            //     //@disabel-check M16
            //     // verticalAlignment: Text.verticalAlignment
            //     horizontalAlignment: Text.horizontalAlignment
            //     text:stress02AimLocation.text
            //     //@disabel-check M16
            //     onEditingFinished: {
            //         stress02AimLocation.text = stress02AimLocation_Input.text
            //         stress02AimLocation_Input.visible = false
            //         stress02AimLocation.visible = true
            //     }
            // }

            // MouseArea{
            //     anchors.fill: parent
            //     acceptedButtons: Qt.LeftButton
            //     //@disabel-check M16
            //     propagateComposedEvents: true

            //     onClicked: {
            //         mouse.accepted = false
            //         stress02AimLocation.visible = false
            //         stress02AimLocation_Input.visible = true
            //         stress02AimLocation_Input.forceActiveFocus()
            //     }
            // }
        }

        Rectangle{
            width: 200
            height: 80
            color: "#00adfb"
            radius: 10
            border.width: 1
            border.color: "#008edd"
            anchors.top: parent.top
            anchors.topMargin: 580
            anchors.left: parent.left
            anchors.leftMargin: 530

            Text{           // 压力3待命点
                id:stress03AimLocation
                anchors.centerIn: parent
                font.pixelSize: 40
                font.bold: true
                color: "white"
                text: Cpp_Connect.stress03Standby
            }

            // TextInput{
            //     id:stress03AimLocation_Input
            //     anchors.centerIn: parent
            //     font.pixelSize: 40
            //     font.bold: true
            //     visible: false
            //     color: "white"
            //     selectByMouse: true
            //     maximumLength: 8
            //     //@disabel-check M16
            //     // verticalAlignment: Text.verticalAlignment
            //     horizontalAlignment: Text.horizontalAlignment
            //     text:stress03AimLocation.text
            //     //@disabel-check M16
            //     onEditingFinished: {
            //         stress03AimLocation.text = stress03AimLocation_Input.text
            //         stress03AimLocation_Input.visible = false
            //         stress03AimLocation.visible = true
            //     }
            // }

            // MouseArea{
            //     anchors.fill: parent
            //     acceptedButtons: Qt.LeftButton
            //     //@disabel-check M16
            //     propagateComposedEvents: true

            //     onClicked: {
            //         mouse.accepted = false
            //         stress03AimLocation.visible = false
            //         stress03AimLocation_Input.visible = true
            //         stress03AimLocation_Input.forceActiveFocus()
            //     }
            // }
        }


        Rectangle{
            width: 200
            height: 80
            color: "#00adfb"
            radius: 10
            border.width: 1
            border.color: "#008edd"
            anchors.top: parent.top
            anchors.topMargin: 700
            anchors.left: parent.left
            anchors.leftMargin: 530

            Text{           // 前刀1待命点
                id:f_knife01AimLocation
                anchors.centerIn: parent
                font.pixelSize: 40
                font.bold: true
                color: "white"
                text: Cpp_Connect.f_knife01Standby
            }

            // TextInput{
            //     id:f_knife01AimLocation_Input
            //     anchors.centerIn: parent
            //     font.pixelSize: 40
            //     font.bold: true
            //     visible: false
            //     color: "white"
            //     selectByMouse: true
            //     maximumLength: 8
            //     //@disabel-check M16
            //     // verticalAlignment: Text.verticalAlignment
            //     horizontalAlignment: Text.horizontalAlignment
            //     text:f_knife01AimLocation.text
            //     //@disabel-check M16
            //     onEditingFinished: {
            //         f_knife01AimLocation.text = f_knife01AimLocation_Input.text
            //         f_knife01AimLocation_Input.visible = false
            //         f_knife01AimLocation.visible = true
            //     }
            // }

            // MouseArea{
            //     anchors.fill: parent
            //     acceptedButtons: Qt.LeftButton
            //     //@disabel-check M16
            //     propagateComposedEvents: true

            //     onClicked: {
            //         mouse.accepted = false
            //         f_knife01AimLocation.visible = false
            //         f_knife01AimLocation_Input.visible = true
            //         f_knife01AimLocation_Input.forceActiveFocus()
            //     }
            // }
        }

        Rectangle{
            width: 200
            height: 80
            color: "#00adfb"
            radius: 10
            border.width: 1
            border.color: "#008edd"
            anchors.top: parent.top
            anchors.topMargin: 820
            anchors.left: parent.left
            anchors.leftMargin: 530

            Text{           // 前刀2待命点
                id:f_knife02AimLocation
                anchors.centerIn: parent
                font.pixelSize: 40
                font.bold: true
                color: "white"
                text: Cpp_Connect.f_knife02Standby
            }

            // TextInput{
            //     id:f_knife02AimLocation_Input
            //     anchors.centerIn: parent
            //     font.pixelSize: 40
            //     font.bold: true
            //     visible: false
            //     color: "white"
            //     selectByMouse: true
            //     maximumLength: 8
            //     //@disabel-check M16
            //     // verticalAlignment: Text.verticalAlignment
            //     horizontalAlignment: Text.horizontalAlignment
            //     text:f_knife02AimLocation.text
            //     //@disabel-check M16
            //     onEditingFinished: {
            //         f_knife02AimLocation.text = f_knife02AimLocation_Input.text
            //         f_knife02AimLocation_Input.visible = false
            //         f_knife02AimLocation.visible = true
            //     }
            // }

            // MouseArea{
            //     anchors.fill: parent
            //     acceptedButtons: Qt.LeftButton
            //     //@disabel-check M16
            //     propagateComposedEvents: true

            //     onClicked: {
            //         mouse.accepted = false
            //         f_knife02AimLocation.visible = false
            //         f_knife02AimLocation_Input.visible = true
            //         f_knife02AimLocation_Input.forceActiveFocus()
            //     }
            // }
        }

        Rectangle{
            width: 200
            height: 80
            color: "#00adfb"
            radius: 10
            border.width: 1
            border.color: "#008edd"
            anchors.top: parent.top
            anchors.topMargin: 940
            anchors.left: parent.left
            anchors.leftMargin: 530

            Text{           // 前刀3待命点
                id:f_knife03AimLocation
                anchors.centerIn: parent
                font.pixelSize: 40
                font.bold: true
                color: "white"
                text: Cpp_Connect.f_knife03Standby
            }

            // TextInput{
            //     id:f_knife03AimLocation_Input
            //     anchors.centerIn: parent
            //     font.pixelSize: 40
            //     font.bold: true
            //     visible: false
            //     color: "white"
            //     selectByMouse: true
            //     maximumLength: 8
            //     //@disabel-check M16
            //     // verticalAlignment: Text.verticalAlignment
            //     horizontalAlignment: Text.horizontalAlignment
            //     text:f_knife03AimLocation.text
            //     //@disabel-check M16
            //     onEditingFinished: {
            //         f_knife03AimLocation.text = f_knife03AimLocation_Input.text
            //         f_knife03AimLocation_Input.visible = false
            //         f_knife03AimLocation.visible = true
            //     }
            // }

            // MouseArea{
            //     anchors.fill: parent
            //     acceptedButtons: Qt.LeftButton
            //     //@disabel-check M16
            //     propagateComposedEvents: true

            //     onClicked: {
            //         mouse.accepted = false
            //         f_knife03AimLocation.visible = false
            //         f_knife03AimLocation_Input.visible = true
            //         f_knife03AimLocation_Input.forceActiveFocus()
            //     }
            // }
        }

        Rectangle{
            width: 200
            height: 80
            color: "#00adfb"
            radius: 10
            border.width: 1
            border.color: "#008edd"
            anchors.top: parent.top
            anchors.topMargin: 1060
            anchors.left: parent.left
            anchors.leftMargin: 530

            Text{           // 后刀1待命点
                id:b_knife01AimLocation
                anchors.centerIn: parent
                font.pixelSize: 40
                font.bold: true
                color: "white"
                text: Cpp_Connect.b_knife01Standby
            }

            // TextInput{
            //     id:b_knife01AimLocation_Input
            //     anchors.centerIn: parent
            //     font.pixelSize: 40
            //     font.bold: true
            //     visible: false
            //     color: "white"
            //     selectByMouse: true
            //     maximumLength: 8
            //     //@disabel-check M16
            //     // verticalAlignment: Text.verticalAlignment
            //     horizontalAlignment: Text.horizontalAlignment
            //     text:b_knife01AimLocation.text
            //     //@disabel-check M16
            //     onEditingFinished: {
            //         b_knife01AimLocation.text = b_knife01AimLocation_Input.text
            //         b_knife01AimLocation_Input.visible = false
            //         b_knife01AimLocation.visible = true
            //     }
            // }

            // MouseArea{
            //     anchors.fill: parent
            //     acceptedButtons: Qt.LeftButton
            //     //@disabel-check M16
            //     propagateComposedEvents: true

            //     onClicked: {
            //         mouse.accepted = false
            //         b_knife01AimLocation.visible = false
            //         b_knife01AimLocation_Input.visible = true
            //         b_knife01AimLocation_Input.forceActiveFocus()
            //     }
            // }
        }

        Rectangle{
            width: 200
            height: 80
            color: "#00adfb"
            radius: 10
            border.width: 1
            border.color: "#008edd"
            anchors.top: parent.top
            anchors.topMargin: 1180
            anchors.left: parent.left
            anchors.leftMargin: 530

            Text{           // 后刀2待命点
                id:b_knife02AimLocation
                anchors.centerIn: parent
                font.pixelSize: 40
                font.bold: true
                color: "white"
                text: Cpp_Connect.b_knife01Standby
            }

            // TextInput{
            //     id:b_knife02AimLocation_Input
            //     anchors.centerIn: parent
            //     font.pixelSize: 40
            //     font.bold: true
            //     visible: false
            //     color: "white"
            //     selectByMouse: true
            //     maximumLength: 8
            //     //@disabel-check M16
            //     // verticalAlignment: Text.verticalAlignment
            //     horizontalAlignment: Text.horizontalAlignment
            //     text:b_knife02AimLocation.text
            //     //@disabel-check M16
            //     onEditingFinished: {
            //         b_knife02AimLocation.text = b_knife02AimLocation_Input.text
            //         b_knife02AimLocation_Input.visible = false
            //         b_knife02AimLocation.visible = true
            //     }
            // }

            // MouseArea{
            //     anchors.fill: parent
            //     acceptedButtons: Qt.LeftButton
            //     //@disabel-check M16
            //     propagateComposedEvents: true

            //     onClicked: {
            //         mouse.accepted = false
            //         b_knife02AimLocation.visible = false
            //         b_knife02AimLocation_Input.visible = true
            //         b_knife02AimLocation_Input.forceActiveFocus()
            //     }
            // }
        }

        Rectangle{
            width: 200
            height: 80
            color: "#00adfb"
            radius: 10
            border.width: 1
            border.color: "#008edd"
            anchors.top: parent.top
            anchors.topMargin: 1300
            anchors.left: parent.left
            anchors.leftMargin: 530

            Text{           // 后刀3待命点
                id:b_knife03AimLocation
                anchors.centerIn: parent
                font.pixelSize: 40
                font.bold: true
                color: "white"
                text: Cpp_Connect.b_knife01Standby
            }

            // TextInput{
            //     id:b_knife03AimLocation_Input
            //     anchors.centerIn: parent
            //     font.pixelSize: 40
            //     font.bold: true
            //     visible: false
            //     color: "white"
            //     selectByMouse: true
            //     maximumLength: 8
            //     //@disabel-check M16
            //     // verticalAlignment: Text.verticalAlignment
            //     horizontalAlignment: Text.horizontalAlignment
            //     text:b_knife03AimLocation.text
            //     //@disabel-check M16
            //     onEditingFinished: {
            //         b_knife03AimLocation.text = b_knife03AimLocation_Input.text
            //         b_knife03AimLocation_Input.visible = false
            //         b_knife03AimLocation.visible = true
            //     }
            // }

            // MouseArea{
            //     anchors.fill: parent
            //     acceptedButtons: Qt.LeftButton
            //     //@disabel-check M16
            //     propagateComposedEvents: true

            //     onClicked: {
            //         mouse.accepted = false
            //         b_knife03AimLocation.visible = false
            //         b_knife03AimLocation_Input.visible = true
            //         b_knife03AimLocation_Input.forceActiveFocus()
            //     }
            // }
        }


        /////////////// 操作按钮 ///////////////////
        Rectangle{
            width: 200
            height: 80
            anchors.top: parent.top
            anchors.topMargin: 100
            anchors.left: parent.left
            anchors.leftMargin: 820
            radius: 10
            color: "#2b6ec5"

            Text{
                anchors.centerIn: parent
                font.pixelSize: 30
                font.bold: true
                color: "white"
                text:"刀盘回待命点"
            }

            MouseArea{
                anchors.fill: parent

                onPressed: {
                    parent.color = "#e44034"
                    Cpp_Connect.write_modbus_tcp_OneHoldingRegisters("2004","2048")

                }

                onReleased: {
                    parent.color = "#2b6ec5"
                    Cpp_Connect.write_modbus_tcp_OneHoldingRegisters("2004","0")
                }
            }
        }

        Rectangle{
            width: 200
            height: 80
            anchors.top: parent.top
            anchors.topMargin: 220
            anchors.left: parent.left
            anchors.leftMargin: 820
            radius: 10
            color: "#2b6ec5"

            Text{
                anchors.centerIn: parent
                font.pixelSize: 30
                font.bold: true
                color: "white"
                text:"胶辊回待命点"
            }

            MouseArea{
                anchors.fill: parent

                onPressed: {
                    parent.color = "#e44034"
                    Cpp_Connect.write_modbus_tcp_OneHoldingRegisters("2004","4096")
                }

                onReleased: {
                    parent.color = "#2b6ec5"
                    Cpp_Connect.write_modbus_tcp_OneHoldingRegisters("2004","0")
                }
            }
        }

        Rectangle{
            width: 200
            height: 80
            anchors.top: parent.top
            anchors.topMargin: 340
            anchors.left: parent.left
            anchors.leftMargin: 820
            radius: 10
            color: "#2b6ec5"

            Text{
                anchors.centerIn: parent
                font.pixelSize: 30
                font.bold: true
                color: "white"
                text:"压力1回待命点"
            }

            MouseArea{
                anchors.fill: parent

                onPressed: {
                    parent.color = "#e44034"
                    Cpp_Connect.write_modbus_tcp_OneHoldingRegisters("2004","8192")
                }

                onReleased: {
                    parent.color = "#2b6ec5"
                    Cpp_Connect.write_modbus_tcp_OneHoldingRegisters("2004","0")
                }
            }
        }

        Rectangle{
            width: 200
            height: 80
            anchors.top: parent.top
            anchors.topMargin: 460
            anchors.left: parent.left
            anchors.leftMargin: 820
            radius: 10
            color: "#2b6ec5"

            Text{
                anchors.centerIn: parent
                font.pixelSize: 30
                font.bold: true
                color: "white"
                text:"压力2回待命点"
            }

            MouseArea{
                anchors.fill: parent

                onPressed: {
                    parent.color = "#e44034"
                    Cpp_Connect.write_modbus_tcp_OneHoldingRegisters("2004","16384")
                }

                onReleased: {
                    parent.color = "#2b6ec5"
                    Cpp_Connect.write_modbus_tcp_OneHoldingRegisters("2004","0")
                }
            }
        }

        Rectangle{
            width: 200
            height: 80
            anchors.top: parent.top
            anchors.topMargin: 580
            anchors.left: parent.left
            anchors.leftMargin: 820
            radius: 10
            color: "#2b6ec5"

            Text{
                anchors.centerIn: parent
                font.pixelSize: 30
                font.bold: true
                color: "white"
                text:"压力3回待命点"
            }

            MouseArea{
                anchors.fill: parent

                onPressed: {
                    parent.color = "#e44034"
                    Cpp_Connect.write_modbus_tcp_OneHoldingRegisters("2004","32768")
                }

                onReleased: {
                    parent.color = "#2b6ec5"
                    Cpp_Connect.write_modbus_tcp_OneHoldingRegisters("2004","0")
                }
            }
        }

        Rectangle{
            width: 200
            height: 80
            anchors.top: parent.top
            anchors.topMargin: 700
            anchors.left: parent.left
            anchors.leftMargin: 820
            radius: 10
            color: "#2b6ec5"

            Text{
                anchors.centerIn: parent
                font.pixelSize: 30
                font.bold: true
                color: "white"
                text:"前刀1回待命点"
            }

            MouseArea{
                anchors.fill: parent

                onPressed: {
                    parent.color = "#e44034"
                    Cpp_Connect.write_modbus_tcp_OneHoldingRegisters("2004","1")
                }

                onReleased: {
                    parent.color = "#2b6ec5"
                    Cpp_Connect.write_modbus_tcp_OneHoldingRegisters("2004","0")
                }
            }
        }

        Rectangle{
            width: 200
            height: 80
            anchors.top: parent.top
            anchors.topMargin: 820
            anchors.left: parent.left
            anchors.leftMargin: 820
            radius: 10
            color: "#2b6ec5"

            Text{
                anchors.centerIn: parent
                font.pixelSize: 30
                font.bold: true
                color: "white"
                text:"前刀2回待命点"
            }

            MouseArea{
                anchors.fill: parent

                onPressed: {
                    parent.color = "#e44034"
                    Cpp_Connect.write_modbus_tcp_OneHoldingRegisters("2004","2")
                }

                onReleased: {
                    parent.color = "#2b6ec5"
                    Cpp_Connect.write_modbus_tcp_OneHoldingRegisters("2004","0")
                }
            }
        }

        Rectangle{
            width: 200
            height: 80
            anchors.top: parent.top
            anchors.topMargin: 940
            anchors.left: parent.left
            anchors.leftMargin: 820
            radius: 10
            color: "#2b6ec5"

            Text{
                anchors.centerIn: parent
                font.pixelSize: 30
                font.bold: true
                color: "white"
                text:"前刀3回待命点"
            }

            MouseArea{
                anchors.fill: parent

                onPressed: {
                    parent.color = "#e44034"
                    Cpp_Connect.write_modbus_tcp_OneHoldingRegisters("2004","4")
                }

                onReleased: {
                    parent.color = "#2b6ec5"
                    Cpp_Connect.write_modbus_tcp_OneHoldingRegisters("2004","0")
                }
            }
        }



        Rectangle{
            width: 200
            height: 80
            anchors.top: parent.top
            anchors.topMargin: 1060
            anchors.left: parent.left
            anchors.leftMargin: 820
            radius: 10
            color: "#2b6ec5"

            Text{
                anchors.centerIn: parent
                font.pixelSize: 30
                font.bold: true
                color: "white"
                text:"后刀1回待命点"
            }

            MouseArea{
                anchors.fill: parent

                onPressed: {
                    parent.color = "#e44034"
                    Cpp_Connect.write_modbus_tcp_OneHoldingRegisters("2004","8")
                }

                onReleased: {
                    parent.color = "#2b6ec5"
                    Cpp_Connect.write_modbus_tcp_OneHoldingRegisters("2004","0")
                }
            }
        }

        Rectangle{
            width: 200
            height: 80
            anchors.top: parent.top
            anchors.topMargin: 1180
            anchors.left: parent.left
            anchors.leftMargin: 820
            radius: 10
            color: "#2b6ec5"

            Text{
                anchors.centerIn: parent
                font.pixelSize: 30
                font.bold: true
                color: "white"
                text:"后刀2回待命点"
            }

            MouseArea{
                anchors.fill: parent

                onPressed: {
                    parent.color = "#e44034"
                    Cpp_Connect.write_modbus_tcp_OneHoldingRegisters("2004","16")
                }

                onReleased: {
                    parent.color = "#2b6ec5"
                    Cpp_Connect.write_modbus_tcp_OneHoldingRegisters("2004","0")
                }
            }
        }

        Rectangle{
            width: 200
            height: 80
            anchors.top: parent.top
            anchors.topMargin: 1300
            anchors.left: parent.left
            anchors.leftMargin: 820
            radius: 10
            color: "#2b6ec5"

            Text{
                anchors.centerIn: parent
                font.pixelSize: 30
                font.bold: true
                color: "white"
                text:"后刀3回待命点"
            }

            MouseArea{
                anchors.fill: parent

                onPressed: {
                    parent.color = "#e44034"
                    Cpp_Connect.write_modbus_tcp_OneHoldingRegisters("2004","32")
                }

                onReleased: {
                    parent.color = "#2b6ec5"
                    Cpp_Connect.write_modbus_tcp_OneHoldingRegisters("2004","0")
                }
            }
        }

    }
}
